package com.huafeng.security;

import com.huafeng.model.entity.SysUser;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.util.CollectionUtils;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * @author 花风
 * @date 2023/8/20 18:27
 * @Description 自定义用户
 */
public class CustomUser extends User {
    private SysUser sysUser;

    public CustomUser(SysUser sysUser){
        this(sysUser,null);
    }

    public CustomUser(SysUser sysUser,List<? extends GrantedAuthority> authorities){
        super(sysUser.getUsername(),sysUser.getPassword(),authorities);
        this.sysUser = sysUser;
    }

    public SysUser getSysUser() {
        return this.sysUser;
    }

    public void setSysUser(SysUser sysUser) {
        this.sysUser = sysUser;
    }
}
